﻿using System.Diagnostics;

namespace Tree
{
    /// <summary>
    /// Assignment Node ie. 'x = 1'
    /// </summary>
    class AssignNode : BiNode
    {
        public AssignNode(Node Left, Node Right)
            : base(Left, Right)
        {
            _pLeft = Left;
            _pRight = Right;
            Debug.Assert(Left.IsLvalue());
        }
        public override double Result
        {
            get
            {
                double x = _pRight.Result;
                _pLeft.Assign(x);
                return x;
            }
        }



        private Node _pLeft;
        private Node _pRight;
    }
}